<template>
	<view>
		<view class="header status_bar" :class="scrrol == true ? 'scrrolHeader' : ''">
			<view class="back iconfont icon-xiangzuo1" @tap="backPage"></view>
			<view class="text" :class="scrrol == true ? 'scrrolHeader' : ''">收入明细</view>
		</view>	
		<view class="clear_box"></view>
		
		<block v-for="(item, index) in info">
			<view class="records_list">
				<view class="text_box">
					<view class="title">{{item.name}}</view>
					<view class="time">{{item.created_at}}</view>
				</view>
				<view class="text_box">
					<view class="money" v-if="item.type == 2">￥-{{item.money}}</view>
					<view class="money" v-if="item.type == 1">￥{{item.money}}</view>
					<!-- <view class="text"></view> -->
				</view>
			</view>
		</block>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				page:1,
				scrrol:false,
				info:'',
				
			}
		},
		onLoad() {
			let that = this;
			that.loadData();
		},
		methods: {
			loadData() {
				let that = this;
				that.Net._get('auth/money_log', {per_page:'10',page:that.page,}, res => {
					if (res.code == 200) {
						that.info = res.data.data;
					}
				});
			},
			backPage() {
				uni.navigateBack({});
			},
			gotopage(e) {
				let url = e.currentTarget.dataset.url;
				uni.navigateTo({
					url: url
				});
			},

		},
		onPageScroll: function(Object) {
			//console.log(Object.scrollTop); //实时获取到滚动的值
			if (Object.scrollTop > 28) {
				this.scrrol = true;
				/* #ifdef APP-PLUS */
				/* #endif */
			} else if (Object.scrollTop < 28) {
				this.scrrol = false;
				/* #ifdef APP-PLUS */
				/* #endif */
			}
		},
		onReachBottom() {
		  var that = this;
		  that.page++;
		  that.Net._get('auth/team', {per_page:'10',page:that.page,}, res => {
		    if (res.code == 200) {
		      //console.log(res)
		      if (res.data.data == '') {
		        uni.showToast({
		          title: '已经是最后一页了',
		          duration: 2000,
		          icon: 'none'
		        });
		      } else {
		        that.info = that.info.concat(res.data.data); //将数据拼接在一起
		      }
		    } else if (res.code == 0) {
		      that.Msg.Success(res.msg, res => {});
		    }
		  });
		},
	}
</script>

<style>

	.scrrolHeader{
		background-color: #FF7701 !important;
	}
	
	.records_list{
		width: 92%;
		margin: 4% auto 0;
		background-color: #fff;
		padding: 5vw 4vw;
		border-radius: 3vw;
		display: flex;
		align-items: center;
	}
	
	.records_list .text_box{
		flex: 1;
	}
	
	.records_list .text_box .title{
		font-size: 4vw;
		color: #333;
		font-weight: bold;
	}
	
	.records_list .text_box .time{
		font-size: 3.5vw;
		color: #999999;
		margin-top: 2vw;
	}
	
	.records_list .text_box .money{
		font-size: 3.8vw;
		color: #333;
		font-weight: bold;
		text-align: right;
	}
	
	.records_list .text_box .text{
		font-size: 3.5vw;
		color: #999999;
		margin-top: 2vw;
		text-align: right;
	}
	
	
	
	
</style>
